const path = require('path');
const resolve = dir => {
  return path.join(__dirname, dir);
};

module.exports = {
  publicPath: './',
  outputDir: 'dist',
  lintOnSave: true,
  // 调整内部的 webpack 配置。
  chainWebpack: config => {
    config.resolve.alias
      .set('@', resolve('src/'))
      .set('@views', resolve('src/views/'))
      .set('@utils', resolve('src/utils/'))
      .set('@components', resolve('src/components/'))
      .set('@images', resolve('src/assets/images/'))
      .set('@api', resolve('src/api/'));
  },
  configureWebpack: {
    // devtool: 'source-map',
  },
  // 配置 webpack-dev-server 行为。
  devServer: {
    // open: process.platform === 'darwin',
    // host: '0.0.0.0',
    port: 8080,
    // https: false,
    // hotOnly: false,
    proxy: {
      '/test': {
        // target: 'http://10.201.13.93:10000/',
        // target:'http://10.201.0.19:10001',//设备调试
        target: process.env.VUE_APP_BASE_API || 'http://10.150.8.113:10000', // dev
        // target: 'http://10.150.8.107:10000', // 107
        // target: 'http://10.150.8.143:10000', // dev
        // target: 'http://10.201.13.123:10001', // chenhuan
        // target: 'http://10.201.13.100:10000', // 3.0登陆
        // target: 'http://10.150.8.118:32001', // lwl
        // target: 'http://10.201.14.196:10000', // chenzhouzhan2
        pathRewrite: { '^/test': '' },
      },
    },
    overlay: {
      warnings: false,
      errors: true,
    },
    before: app => { },
  },
  css: {
    loaderOptions: {
      sass: {
        data: `
                @import "@/assets/css/theme.scss";
            `,
      },
    },
  },
};
